const express = require('express');
const router = express.Router();
const recheckController = require('../controllers/recheckRequestMange.controller');
const { verifyToken, isSubjectGroupLeader } = require('../middlewares/auth.middleware');

// 根据用户ID分页获取查卷审核列表 (需要学科组长权限)
router.get('/getRecheckRequestList', verifyToken, isSubjectGroupLeader, recheckController.getRecheckRequestList);

// 学科组长根据学生试卷ID进行查卷 (需要学科组长权限)
router.post('/recheckBySelf', verifyToken, isSubjectGroupLeader, recheckController.recheckBySelf);

// 学科组长驳回查卷申请 (需要学科组长权限)
router.post('/rejectTheRequest', verifyToken, isSubjectGroupLeader, recheckController.rejectTheRequest);

// 根据学生试卷ID查找申请驳回的原因 (需要学科组长权限)
router.get('/getRejectReason', verifyToken, recheckController.getRejectReason);

// 根据用户ID获取该学科的所有学科教师 (需要学科组长权限)
router.get('/getSubjectTeachers', verifyToken, isSubjectGroupLeader, recheckController.getSubjectTeachers);

// 给教师分配复审任务 (需要学科组长权限)
router.post('/RecheckAssignment', verifyToken, isSubjectGroupLeader, recheckController.assignRecheckTask);

// 获取复审结果 (需要token验证)
router.get('/getRecheckResult', verifyToken, recheckController.getRecheckResult);

// 发送复审结果给申请查卷的教师 (需要学科组长权限)
router.post('/recoverRecheckResult', verifyToken, isSubjectGroupLeader, recheckController.recoverRecheckResult);

module.exports = router;
